﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using TV_2013.Resources;

namespace TV_2013
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }

        private void btn_ChucNang1_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/View/Feature1/ViewFeatureOne.xaml", UriKind.RelativeOrAbsolute));
        }

        //chuc nang choi ma hoc
        private void btn_ChucNang2_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/View/Feature2/MainGameScreen.xaml", UriKind.RelativeOrAbsolute));
        }

        //chu nang tap danh van 
        private void btn_ChucNang3_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/View/Feature3/ViewFeatureThree.xaml", UriKind.RelativeOrAbsolute));
        }

        private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
        {

            while (NavigationService.RemoveBackEntry() != null)
            {
                NavigationService.RemoveBackEntry();
            }

            //e.Cancel = true;
            //MessageBoxResult result = MessageBox.Show("Bạn có muốn thoát khỏi ứng dụng Tiếng Việt 1", "",
            //                                     MessageBoxButton.OKCancel);

            //if (result == MessageBoxResult.Cancel)
            //{
            //    e.Cancel = true;
            //}

            //if (result == MessageBoxResult.OK)
            //{
                
            //    e.Cancel = false;
            //    base.OnBackKeyPress(e);
            //}

        }

        // Sample code for building a localized ApplicationBar
        //private void BuildLocalizedApplicationBar()
        //{
        //    // Set the page's ApplicationBar to a new instance of ApplicationBar.
        //    ApplicationBar = new ApplicationBar();

        //    // Create a new button and set the text value to the localized string from AppResources.
        //    ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
        //    appBarButton.Text = AppResources.AppBarButtonText;
        //    ApplicationBar.Buttons.Add(appBarButton);

        //    // Create a new menu item with the localized string from AppResources.
        //    ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
        //    ApplicationBar.MenuItems.Add(appBarMenuItem);
        //}
    }
}